package com.dragon.datastructure.tree.redblacktree;

import com.dragon.datastructure.tree.avl.AvlTree;

/**
 * 红黑树测试
 *
 * @author dragon
 * @since 2020/1/4
 */
public class Test {


    public static void main(String[] args) {
        int count = 10_000_000;

        AvlTree<Integer> avlTree = new AvlTree<>();
        long startTime2 = System.nanoTime();
        for (int i = 0; i < count; i++) {
            avlTree.add(i);
        }
        long endTime2 = System.nanoTime();
        System.out.println("avlTree add speed time:" + (endTime2 - startTime2) / 1000000000.0 + "秒");

        RedBlackTree<Integer> redBlackTree = new RedBlackTree<>();
        long startTime3 = System.nanoTime();
        for (int i = 0; i < count; i++) {
            redBlackTree.add(i);
        }
        long endTime3 = System.nanoTime();
        System.out.println("redBlackTree add speed time:" + (endTime3 - startTime3) / 1000000000.0 + "秒");

    }
}
